﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true"
    CodeFile="NhanVien.aspx.cs" Inherits="NhanVien" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:UpdatePanel ID="up1" runat="server">
        <ContentTemplate>
            <div class="panel panel-success margin">
                <div class="panel-heading">
                    <h3 class="panel-title">
                        Quản lý nhân viên</h3>
                </div>
                <div class="panel-body">
                    <table width="100%">
                        <tr>
                            <td width="20%">
                                <span style="margin-left: 5px;">Tên nhân viên</span><br />
                                <asp:TextBox ID="txttennhanvien" runat="server" CssClass="form-control with98"></asp:TextBox>
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator1" runat="server"
                                    ControlToValidate="txttennhanvien" ErrorMessage="Nhập tên nhân viên" Display="None"
                                    Text="*"></asp:RequiredFieldValidator>
                            </td>
                            <td width="20%">
                                <span style="margin-left: 5px;">Bộ phận công tác</span><br />
                                <asp:DropDownList ID="drBophan" runat="server" CssClass="form-control with98" DataTextField="TenBoPhan"
                                    DataValueField="IDs">
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator2" runat="server"
                                    ControlToValidate="drBophan" ErrorMessage="Chọn bộ phận công tác" Display="None"
                                    Text="*"></asp:RequiredFieldValidator>
                            </td>
                            <td width="20%">
                                <span style="margin-left: 5px;">Chức vụ</span><br />
                                <asp:DropDownList ID="drChucVu" runat="server" CssClass="form-control with98" DataTextField="TenChucVu"
                                    DataValueField="IDs">
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="drChucVu"
                                    Display="None" ErrorMessage="Nhập chức vụ" Text="*" ValidationGroup="Them"></asp:RequiredFieldValidator>
                            </td>
                            <td width="20%">
                                <span style="margin-left: 5px;">Trạm trộn</span><br />
                                <asp:DropDownList ID="dlTramTron" runat="server" CssClass="form-control with98"
                                    DataTextField="TenTramTron" DataValueField="IDs">
                                </asp:DropDownList>
                                <asp:RequiredFieldValidator ValidationGroup="Them" ID="RequiredFieldValidator4" runat="server"
                                    ControlToValidate="dlTramTron" ErrorMessage="Chọn trạm trộn" Display="None" Text="*"></asp:RequiredFieldValidator>
                            </td>
                            <td>
                                <span style="margin-left: 5px;">Địa chỉ</span><br />
                                <asp:TextBox ID="txtdiachi" runat="server" CssClass="form-control withall"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td width="20%">
                                <span style="margin-left: 5px;">Số chứng minh thư</span><br />
                                <asp:TextBox ID="txtcmt" runat="server" CssClass="form-control with98"></asp:TextBox>
                            </td>
                            <td width="20%">
                                <span style="margin-left: 5px;">Ngày cấp</span><br />
                                <asp:TextBox ID="txtngaycap" runat="server" CssClass="form-control with98"></asp:TextBox>
                                <cc1:CalendarExtender PopupPosition="BottomRight" ID="CalendarExtender1" runat="server"
                                    TargetControlID="txtngaycap" Format="dd/MM/yyyy">
                                </cc1:CalendarExtender>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" runat="server" FilterType="Custom,Numbers"
                                    TargetControlID="txtngaycap" ValidChars="/-" />
                            </td>
                            <td width="20%">
                                <span style="margin-left: 5px;">Nơi cấp</span><br />
                                <asp:TextBox ID="txtnoicap" runat="server" CssClass="form-control with98"></asp:TextBox>
                            </td>
                            <td width="20%">
                                <span style="margin-left: 5px;">Ngày vào làm</span><br />
                                <asp:TextBox ID="txtngayvaolamviec" runat="server" CssClass="form-control with98"></asp:TextBox>
                                <cc1:CalendarExtender PopupPosition="BottomRight" ID="CalendarExtender2" runat="server"
                                    TargetControlID="txtngayvaolamviec" Format="dd/MM/yyyy">
                                </cc1:CalendarExtender>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" FilterType="Custom,Numbers"
                                    TargetControlID="txtngayvaolamviec" ValidChars="/-" />
                            </td>
                            <td>
                                <span style="margin-left: 5px;">Ngày kết thúc</span><br />
                                <asp:TextBox ID="txtngayketthuclamviec" runat="server" CssClass="form-control with98"></asp:TextBox>
                                <cc1:CalendarExtender PopupPosition="BottomRight" ID="CalendarExtender3" runat="server"
                                    TargetControlID="txtngayketthuclamviec" Format="dd/MM/yyyy">
                                </cc1:CalendarExtender>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server" FilterType="Custom,Numbers"
                                    TargetControlID="txtngayketthuclamviec" ValidChars="/-" />
                                    
                            </td>
                        </tr>
                        
                        <tr>
                            <td colspan="4">
                                <asp:Button ID="btnSave" ValidationGroup="Them" runat="server" Style="margin-left: 5px;"
                                    Text="Lưu lại" CssClass="btn btn-primary" OnClick="btnAdd_Click" />
                                <asp:Button ID="btncapnhat" runat="server" Text="Cập nhật" CssClass="btn btn-info"
                                    OnClick="btnUpdate_Click" Visible="false" />
                                <asp:Button ID="btnCancel" runat="server" Text="Nhập mới" CssClass="btn btn-warning"
                                    OnClick="btnCancel_Click" />
                                    <asp:CheckBox ID="ckBaoHiem" runat="server" Text="Đã đóng bảo hiểm" />
                                    <asp:CheckBox ID="cknhanvienthoivu" runat="server" Text="Nhân viên thời vụ" />
                            </td>
                        </tr>
                    </table>
                    <asp:ValidationSummary ID="ValidationSummary1" HeaderText="Bạn phải nhập các trường sau:"
                        ShowMessageBox="true" ValidationGroup="Them" ShowSummary="false" EnableClientScript="true"
                        runat="server" />
                </div>
            </div>
            <div style="margin: 5px;">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <b>Danh sách trạm trộn</b>
                    </div>
                    <div style="padding-bottom: 10px; padding-top: 15px; margin-left: 20px;">
                        Tìm kiếm
                        <asp:DropDownList runat="server" ID="drTk" OnSelectedIndexChanged="Unnamed1_SelectedIndexChanged"
                            Style="font-family: Times New Roman;" AutoPostBack="true">
                            <asp:ListItem Text="Chọn loại tìm kiếm" Value="0"></asp:ListItem>
                            <asp:ListItem Text="Theo bộ phận" Value="1"></asp:ListItem>
                            <asp:ListItem Text="Theo chức vụ" Value="2"></asp:ListItem>
                            <asp:ListItem Text="Theo tên" Value="3"></asp:ListItem>
                            <asp:ListItem Text="Theo nhân viên đã nghỉ việc" Value="4"></asp:ListItem>
                        </asp:DropDownList>
                        <asp:DropDownList ID="tkDrBoPhan" Visible="false" runat="server" DataTextField="TenBoPhan"
                            Style="font-family: Times New Roman;" DataValueField="IDs">
                        </asp:DropDownList>
                        <asp:DropDownList runat="server" Visible="false" ID="tkDrChucVu" DataTextField="TenChucVu"
                            DataValueField="IDs">
                        </asp:DropDownList>
                        <asp:TextBox runat="server" Visible="false" ID="txttkTen" Width="40%"></asp:TextBox>
                        <asp:TextBox runat="server" Visible="false" ID="txttennghiviec" Width="40%"></asp:TextBox>
                        <asp:Button ID="btnTimkiem" runat="server" Style="margin-left: 5px;" Text="Tìm kiếm"
                            CssClass="btn btn-primary" OnClick="btnTimkiem_Click" />
                    </div>
                    <div style="width: 100%; margin-top: 0px;" class="wrapper">
                        <asp:GridView ID="GV" runat="server" AutoGenerateColumns="false" BackColor="White"
                            BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="1" EmptyDataText="Không có dữ liệu nào"
                            EnableModelValidation="True" ShowFooter="false" CssClass="form-control withall"
                            Width="99%" OnRowCommand="GV_RowCommand">
                            <Columns>
                                <asp:TemplateField HeaderText="Xóa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                    ItemStyle-Width="50px">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="lbXoa" runat="server" Width="20px" Height="20px" ImageUrl="~/img/delete-24.png"
                                            OnClientClick="return confirm('Bạn chắc chắn muốn xóa ?')" CommandArgument='<%#Eval("IDs")%>'
                                            Text="Xóa" CommandName="Del" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Sửa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                    ItemStyle-Width="50px">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="lbSua" runat="server" Width="15px" Height="15px" ImageUrl="~/img/edit.ico"
                                            CommandArgument='<%#Eval("IDs")%>' Text="Sửa" CommandName="Select" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="hoten" ItemStyle-CssClass="padding" HeaderText="Họ tên" />
                                <asp:BoundField DataField="tenbophan" ItemStyle-CssClass="padding" HeaderText="Bộ phận công tác" />
                                <asp:BoundField DataField="tenchucvu" ItemStyle-CssClass="padding" HeaderText="Chức vụ" />
                                <asp:BoundField DataField="ngayvaolamviec" ItemStyle-CssClass="padding" HeaderText="Ngày vào làm" />
                                <asp:BoundField DataField="ngayketthuclamviec" ItemStyle-CssClass="padding" HeaderText="Ngày kết thúc" />
                                <asp:BoundField DataField="songaylamviec" ItemStyle-CssClass="padding" HeaderText="Số ngày làm việc" />
                                <asp:BoundField DataField="trangthai" ItemStyle-CssClass="padding" HeaderText="Trạng thái" />
                            </Columns>
                            <FooterStyle BackColor="White" ForeColor="#000066" Font-Bold="True" HorizontalAlign="Left" />
                            <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black" Height="30px" />
                            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                            <RowStyle BackColor="White" ForeColor="#000066" Height="30px" />
                            <SelectedRowStyle BackColor="Lavender" Font-Bold="false" />
                        </asp:GridView>
                    </div>
                </div>
                <asp:HiddenField ID="hdID" runat="server" />
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
